package com.yuan.fullstackback.service.impl;

import com.yuan.fullstackback.mapper.SysArticleMapper;
import com.yuan.fullstackback.pojo.SysArticle;
import com.yuan.fullstackback.service.ISysArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 文章 - 服务层
 */
@Service
public class SysArticleServiceImpl implements ISysArticleService {

    @Autowired
    private SysArticleMapper articleMapper;

    /**
     * 分页查询所有的文章
     *
     * @return 文章数据
     */
    @Override
    public List<SysArticle> selectAllArticlePage() {
        return articleMapper.selectAllArticlePage();
    }

    /**
     * 添加文章
     *
     * @param sysArticle 文章实体
     */
    @Override
    public int addArticle(SysArticle sysArticle) {
        return articleMapper.addArticle(sysArticle);
    }

    /**
     * 修改文章
     *
     * @param sysArticle 文章实体
     */
    @Override
    public int updateArticle(SysArticle sysArticle) {
        return articleMapper.updateArticle(sysArticle);
    }

    /**
     * 删除文章[逻辑删除]
     *
     * @param articleId 文章Id
     */
    @Override
    public int deleteArticle(Long articleId) {
        return articleMapper.deleteArticle(articleId);
    }
}
